package org.avapir.snake;

import java.awt.Graphics;
import java.awt.Image;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

/**
 * 
 * @author Alpen Ditrix
 *
 */
public class Sprite {

	private Image image;
	
	public Sprite(Image image){
		this.image = image;
	}
	
	public Sprite(String path){
		File img = new File(path);
		try {
			image = ImageIO.read(img);
		} catch (IOException e) {
			e.printStackTrace(System.err);
		}
		
	}
	
	public void draw(Graphics g, int x, int y){
		g.drawImage(image, x, y, null);
	}
	
	public int getHeigth(){
		return image.getHeight(null);
	}
	
	public int getWidth(){
		return image.getWidth(null);
	}
	
}
